<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://www.zkingsoft.com" prefix="matrix"%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/plugin/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
<style type="text/css">
.huanhang {
	word-break: break-all;
	word-wrap: break-all;
}

#serchform .input-group {
    margin: 5px 0;
}
#serchform .select2,.select2-selection--single {
    height: 34px!important;
    width: 100%!important;
}
#serchform .input-group-addon {
    font-weight: 700;
    min-width: 100px;
    border-right: 0!important;
    background: #fbfbfb;
    padding: 0 2%;
    width: 1%!important;
}
#serchform .m-r-10{
	margin-right: 10px;
}
</style>
</head>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<!-- 搜索框部分start -->
		<matrix:btn value="DisDesigner:search">
			<div class="row">
				<div class="col-sm-12">
					<form class="form-inline" id="serchform">
						<div class="row">
							<div class="col-sm-3">
								<div class="input-group">
									<span class="input-group-addon">帐号</span>
									<input placeholder="请输入帐号" name="desAccount" type="text" class="form-control">
								</div>
							</div>
							<div class="col-sm-3">
								<div class="input-group" style="top: 3px;">
									<button onclick="myGrid.serchData()" type="button"
										class="btn btn-info btn-sm m-r-10">
										<i class="fa fa-search "></i> 搜索
									</button>
									<button onclick="MForm.reset('#serchform');" type="button"
										class="btn btn-info btn-sm m-r-10">
										<i class="fa fa-refresh "></i> 重置
									</button>
								</div>
							</div>
						</div>
					</form>
				</div>
			</div>
		</matrix:btn>
		<!-- 搜索框部分en -->
		<div class="ibox-content radius-5 mt-5 mpanel">

			<div class="row">
				<div class="col-sm-12">
					<div class="option-bar">
						<matrix:btn value="DisDesigner:dels">
							<button onclick="myGrid.delItems('desId')" type="button"
								class="btn btn-danger btn-sm">
								<i class="fa fa-trash"></i>批量删除
							</button>
						</matrix:btn>
						<matrix:btn value="DisDesigner:add">
							<button onclick="openAdd()" type="button"
								class="btn btn-success btn-sm">
								<i class="fa fa-plus"></i> 新增
							</button>
						</matrix:btn>
					</div>
					<table id="mgrid">
						<thead>
							<tr>
								<th data-checkbox="true"></th>
								<th data-formatter="MGrid.indexfn" data-align="center"
									data-width="30px">序号</th>
								<th data-field="desAccount">帐号</th>
<!-- 								<th data-field="desPassword">密码</th> -->
								<th data-field="desName">名称</th>
								<th data-field="desSex" data-formatter="setSex">性别</th>
								<th data-field="desHeadimgurl" data-formatter="getHeadimg">头像</th>
								<th data-field="desParentName">上级设计师</th>
								<th data-field="desAuditStatus" data-formatter="setAuditStatus">审核状态</th>
								<th data-align="center" data-width="195px" data-field="desId" data-formatter="buidOperate">操作</th>
							</tr>
						</thead>
					</table>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript"
		src="${path }/resource/js/systools/MJsBase.js"></script>
	<script type="text/javascript">
		function setSex(value, row, index) {
			switch (value) {
			case '0':
				return "未知";
				break;
			case '1':
				return "男";
				break;
			case '2':
				return "女";
				break;
			default:
				return "";
			}
		}

		function setAuditStatus(value, row, index) {
			switch (value) {
			case '1':
				return "待审核";
				break;
			case '2':
				return "审核通过";
				break;
			case '3':
				return "审核不通过";
				break;
			default:
				return "";
			}
		}
		
		function getHeadimg(value, row, index) {
			if(!value || value==''){
				return "";
			}
			return "<img width='100px;' height='80'  src='" + value + "' />";
		}
	</script>
	<script type="text/javascript">
		var myGrid;
		$(function() {
			var delUrl = "";
			<matrix:btn value="DisDesigner:del">
			delUrl = "${path}/admin/disDesigner/del";
			</matrix:btn>
			myGrid = MGrid.initGrid({
				url : "${path}/admin/disDesigner/showList",
				delUrl : delUrl,
			});

		});

		function buidOperate(value, row, index) {
			var html = [];
			<matrix:btn value="DisDesigner:edit">
			html[0] = '<a  onClick="openEdit(' + value
					+ ')"  title="编辑" class="fa fa-edit option"></a>'
			</matrix:btn>
			<matrix:btn value="DisDesigner:del">
			html[1] = '<a onClick="myGrid.delItem('
					+ value
					+ ')" title="删除" class="fa fa-close option text-danger"></a>';
			</matrix:btn>
			return html.join("");
		}
		//打开添加界面
		<matrix:btn value="DisDesigner:add">
		function openAdd() {
			layer.open({
				type : 2,
				title : "添加设计师",
				area : [ MUI.SIZE_L, '400px' ],
				maxmin : true,
				content : [ '${path}/admin/disDesigner/editForm' ]
			});
		}
		</matrix:btn>

		//打开编辑界面
		<matrix:btn value="DisDesigner:edit">
		function openEdit(id) {
			layer.open({
				type : 2,
				title : "编辑设计师",
				area : [ MUI.SIZE_L, '400px' ],
				maxmin : true,
				content : [ '${path}/admin/disDesigner/editForm?id=' + id ]
			});
		}
		</matrix:btn>
		
		
	</script>
</body>
</html>
